load("@fbcode_macros//build_defs:build_file_migration.bzl", "fbcode_target", "non_fbcode_target")
load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library")
load("@fbsource//tools/build_defs/dirsync:fb_dirsync_cpp_library.bzl", "fb_dirsync_cpp_library")
load("@fbsource//xplat/pfh/triage_InfrastructureSupermoduleOptou:DEFS.bzl", "triage_InfrastructureSupermoduleOptou")
load(
    "../../defs.bzl",
    "folly_xplat_library",
)

oncall("fbcode_entropy_wardens_folly")

non_fbcode_target(
    _kind = folly_xplat_library,
    name = "observer_manager",
    srcs = [
        "Core.cpp",
        "ObserverManager.cpp",
    ],
    feature = triage_InfrastructureSupermoduleOptou,
    force_static = False,
    raw_headers = [
        "Core.h",
        "ObserverManager.h",
    ],
    deps = [
        "fbsource//third-party/fmt:fmt",
        "fbsource//xplat/folly/futures:core",
        "fbsource//xplat/folly/portability:gflags",
        "fbsource//xplat/folly/synchronization:sanitize_thread",
        "//third-party/glog:glog",
        "//xplat/folly:exception_string",
        "//xplat/folly:format",
        "//xplat/folly:function",
        "//xplat/folly:range",
        "//xplat/folly:singleton",
        "//xplat/folly:synchronized",
        "//xplat/folly/concurrency:unbounded_queue",
        "//xplat/folly/experimental/observer/detail:graph_cycle_detector",
        "//xplat/folly/system:thread_name",
    ],
    exported_deps = [
        "//xplat/folly/fibers:core_manager",
    ],
)

fb_dirsync_cpp_library(
    name = "graph_cycle_detector",
    headers = ["GraphCycleDetector.h"],
    feature = triage_InfrastructureSupermoduleOptou,
    use_raw_headers = True,
    xplat_impl = folly_xplat_library,
    exported_external_deps = [
        "glog",
    ],
)

# !!!! fbcode/folly/observer/detail/TARGETS was merged into this file, see https://fburl.com/workplace/xl8l9yuo for more info !!!!

fbcode_target(
    _kind = cpp_library,
    name = "observer_manager",
    srcs = [
        "Core.cpp",
        "ObserverManager.cpp",
    ],
    headers = [
        "Core.h",
        "ObserverManager.h",
    ],
    deps = [
        "fbsource//third-party/fmt:fmt",
        "//folly:exception_string",
        "//folly:format",
        "//folly:range",
        "//folly:singleton",
        "//folly/concurrency:unbounded_queue",
        "//folly/portability:gflags",
        "//folly/system:thread_name",
    ],
    exported_deps = [
        "//folly:function",
        "//folly:portability",
        "//folly:synchronized",
        "//folly/experimental/observer/detail:graph_cycle_detector",
        "//folly/fibers:core_manager",
        "//folly/functional:invoke",
        "//folly/futures:core",
        "//folly/synchronization:sanitize_thread",
    ],
    exported_external_deps = [
        "glog",
    ],
)
